import React ,{ ReactElement } from "react";
import {Link} from 'react-router-dom'
import css from './index.less'
export interface INews{
    id:string,
    title:string,
    content?:string
    pic?:string,
    date:string,
}
export default function News ({news,prev,next}:{news:INews,prev?:INews,next?:INews}):ReactElement{
    return <div className={css.newsRead}>
        <div className={css.titleContainer}>
            <div className={css.title}>{news.title}</div>
            <div className={css.date}>{news.date}</div>
        </div>
        <div className={css.content}>
            {news.content}
        </div>
        <div className={css.relatedRead}>
            {prev ? <Link to={`/news/${prev.id}`}></Link> : ''}
            {next ? <Link to={`/news/${next.id}`}></Link> : ''}
        </div>
    </div>
}